/**
 * Copyright (c) 2010 Basil Shikin, BugStat Project
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.bugstat.gui.wizard;

import javax.swing.JLabel;
import javax.swing.JProgressBar;

import net.miginfocom.swing.MigLayout;

import org.bugstat.common.utils.ProgressListener;
import org.bugstat.gui.UIStrings;
import org.pietschy.wizard.PanelWizardStep;

/**
 * This is a page with generate progress.
 *
 * @author Basil Shikin
 */
public class ProgressPage
    extends PanelWizardStep
{
    private static final long serialVersionUID = 8338359357995879235L;
    
    private final JProgressBar progressBar;
    
    private final ProgressListener progressListener;
    public ProgressPage()
    {
        setName(UIStrings.TEXT_CREATING_REPORTS );
        setSummary(UIStrings.TEXT_CREATING_REPORTS_SUMMARY );

        final JLabel outputFolderLabel = new JLabel( UIStrings.TEXT_OPERATION_PROGRESS + ":" );
        progressBar = new JProgressBar(0, 100 );

        progressListener = new ProgressListener() {
            @Override
            public void progressReported(int progress)
            {
                progressBar.setValue( progress );
            }
        };
        
        setLayout( new MigLayout("fill", "9[grow]9", "40%[]5[]push") );
        add( outputFolderLabel, "wrap" );
        add( progressBar, "growx, wrap" );
        
        setComplete( false );
    }

    ProgressListener getProgressListener()
    {
        return progressListener;
    }
}
